import './index.scss';
const GlobalLoading: React.FC = () => {
	const [loading, setLoading] = useState(false);

	// 挂载到window对象上
	useEffect(() => {
		(window as any).$loading = {
			show: () => setLoading(true),
			hide: () => setLoading(false)
		};
	}, []);
	if (!loading) return null;
	return (
		<div className="global-loading-overlay">
			<ASpin size="large" />
		</div>
	);
};

export default GlobalLoading;
